#!/usr/bin/env python
# -*- coding: utf-8 -*-


from .utils import tools
from .utils import odoorpc


def main():
    data = tools.get_csv_data()
    print(data)

    # file_name = tools.get_arg('--data')
    # csv_out_name = file_name[0:-4] + '_out.csv'

    cfg = tools.get_config()
    print('cfg,', cfg)

    options = cfg.get('options')
    odoo = odoorpc.get_odoo(**options)

    recs = [odoo.env['iot.gateway'].regsiter(rec['code']) for rec in data]
    print('regsiter', recs)
